/*
 * LCells.h
 *
 *  Created on: Dec 18, 2014
 *      Author: marchi
 */

#ifndef LINKEDCELLS_SRC_LCELLS_H_
#define LINKEDCELLS_SRC_LCELLS_H_

#include <vector>
#include "Atoms.h"
#include "Metric.h"

using namespace std;

class LCells {
	static double Rcut;
	static vector<int> nc;
	vector<vector<int> >  indx;
	matrix co;
	rvec * x;
	int nr;
	vector<vector<int> > nnl;
	void setupAtoms(Atoms & y){
		const matrix & cc=y.getMt().getCO();
		for(size_t n=0;n<DIM;n++)
			for(size_t m=0;m<DIM;m++)
				co[n][m]=cc[n][m];
		x=y.getX();
		nr=y.getNR();
	}
	double Dist_ijk(int, int,int);
	void Index();

public:
	LCells();
	LCells(Atoms & y){
		setupAtoms(y);
	}
	LCells(matrix &, int, rvec *);
	static void Setup(double rcut, int nx, int ny, int nz){
		Rcut=rcut;
		int n[]={nx,ny,nz};
		nc=vector<int>(n,n+DIM);
	}
	static void Setup(double rcut){
		Rcut=rcut;
	}
	void operator()(Atoms & y){
		setupAtoms(y);
	}
	vector<vector<int> > & List();
	virtual ~LCells();
};

#endif /* LINKEDCELLS_SRC_LCELLS_H_ */
